NEWENTRY = 'Bitte neue Eingabe tätigen.'
NOLETTER = 'Keine Buchstaben erlaubt.'
NODIGIT = 'Keine Zahlen erlaubt.'
NOTALLOWED = ' ist kein erlaubtes Zeichen.'
NOSYM = 'Keine Sonderzeichen, Punkte und Kommas erlaubt.'



def solid_int():
    '''
    Asks for input itself.
    Returns integer.
    '''
    allowedchars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    while True:
        n = input()
        if len(n) < 1:
            print('Eingabe zu kurz!')
        if str(n).isalpha() == True:
            print(NOLETTER + ' ' + NEWENTRY)
        if '.' in str(n):
            print(NOSYM + ' ' + NEWENTRY)
        bad = []
        for char in n:
            if str(char) not in allowedchars:
                print(char + NOTALLOWED)
                bad.append(char)
        if len(bad) == 0 and len(n) >= 1:
            return int(n)
        else:
            print(NEWENTRY)

def solid_abc():
    '''
    Asks for input itself.
    Returns string consisting of the german Alphabet.
    '''
    allowedchars = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ü', 'Ö', 'Ä']
    while True:
        n = input()
        if len(n) < 1:
            print('Eingabe zu kurz!')
        if str(n).upper().isnumeric() == True:
            print(NODIGIT + ' ' + NEWENTRY)
        bad = []
        for char in n:
            if char.upper() not in allowedchars:
                print(char + NOTALLOWED)
                bad.append(char)
        if len(bad) == 0:
            return n
        else:
            print(NEWENTRY)


def solid_restrict_string(x):
    '''
    x = LIST of forbidden characters

    returns a string that can contain anything except the forbidden characters.
    asks for input until a string without characters contained in y is read.
    '''
    forbidden = set(x)
    bad = ''
    while True:

        given = input('Zeichenfolge eingeben. Verbotene Zeichen: ' + str(forbidden).strip('{').strip('}') + '\n')
        for character in given:
            if str(character).upper() in forbidden or character in forbidden:
                bad = bad + character
        print(len(bad))
        if len(bad) == 0:
            return given
        else:
            print('Die Eingabe enthielt ein verbotenes Zeichen. Erneute Eingabe notwendig. \n')



def solid_remove_string(x):
    '''
    x = LIST of forbidden characters
    returns stripped input, removing all forbidden chars.
    asks for input once and removes every character in x from user input.
    '''
    forbidden = set(x)
    given = input('Zeichenfolge eingeben. Entfernte Zeichen: ' + str(forbidden).strip('{').strip('}') + '\n')
    output = ''
    if len(given) < 1:
        print('Eingabe zu kurz!')
    for character in given:
        if str(character).upper() in forbidden or character in forbidden:
            pass
        else:
            output = output + character
    return output


def solid_choice(allowed_char_list):
    '''
    asks for input. requires a list of allowed characters ['A', 'X', 'Z'] in upper cases in order to work correctly.
    '''
    allowed = set(allowed_char_list)
    while True:
        bad = []
        given = input()
        for char in given:
            if char.upper() not in allowed:
                if len(str(given)) > 0:
                    print(str(char) + ' ist kein erlaubtes Zeichen!')
                    bad.append(char)
            else:
                pass
        if len(bad) == 0 and len(str(given)) > 0:
            return str(given)
        else:
            print('Folgende Zeichen waren nicht erlaubt: ' + str(bad).strip('[').strip(']').strip('"'))